<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>二手交易平台</title>
  <link rel="stylesheet" type="text/css" href="/ssm/consumer/res/static/css/main.css">
  <link rel="stylesheet" type="text/css" href="/ssm/consumer/res/layui/css/layui.css">
  <script type="text/javascript" src="/ssm/consumer/res/layui/layui.js"></script>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
   <link rel="stylesheet" href="/ssm/static/system/layui/css/layui.css"
          media="all" />
  <style type="text/css">
  	.userNotLogin{
  		display: none;
  	}
  	.layui-form-onswitch i {
	    left: 32px;
	     margin-left: 0px; 
	    background-color: #fff;
	}
  </style>
</head>
<body>

  <div class="site-nav-bg">
    <div class="site-nav w1200">
      <p class="sn-back-home">
        <i class="layui-icon layui-icon-home"></i>
        <a href="/ssm/consumer/index.html">首页</a>
      </p>
      <div class="sn-quick-menu">
        	<div class="userLogin">
        		<div class="login"><a href="/ssm/consumer/login.html">登录</a></div>
        		<div class="login"><a href="/ssm/consumer/register.html">注册</a></div>
        	</div>
        	<div class="userNotLogin">
        		<div class="login"><a href="/ssm/consumer/userInfo.html" id="username">用户名</a></div>
        		<div class="login"><a href="JavaScript:loginOut();">退出</a></div>
        		<div class="login"><a href="/ssm/consumer/myOrder.html">我的订单</a></div>
        		<div class="sp-cart"><a href="/ssm/consumer/shopcart.html">购物车</a></div>
        	</div>
      </div>
    </div>
  </div>



  <div class="header">
    <div class="headerLayout w1200">
      <div class="headerCon">
        <h1 class="mallLogo">
           <a href="/ssm/consumer/index.html" title="">
            <img src="/ssm/consumer/res/static/img/logo.png">
          </a>
        </h1>
        <div class="mallSearch">
          <form action="" class="layui-form" novalidate>
            <input type="text" id="keyword" name="title" required  lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入需要的商品">
            <button class="layui-btn" id="searchbutton" lay-filter="formDemo" onclick="return false">
                <i class="layui-icon layui-icon-search"></i>
            </button>
            <input type="hidden" name="" value="">
          </form>
        </div>
      </div>
    </div>
  </div>


   <div class="content content-nav-base shopcart-content">
    <div class="main-nav">
      <div class="inner-cont0">
        <div class="inner-cont1 w1200">
          <div class="inner-cont2">
            <a href="/ssm/consumer/index.html">首页</a>
          </div>
          <div class="inner-cont2">
            <a href="#" class="active">我的商品</a>
          </div>
          <div class="inner-cont2">
            <a href="/ssm/consumer/myCommnet.html" >评论回复</a>
          </div>
        </div>
      </div>
    </div>
    <div class="banner-bg w1200">
    </div>
    <div class="cart w1200">
     	<!-- 数据表格 -->
	 <div class="layui-inline">
         <button id="addBtn" class="layui-btn search-btn" >
              <i class="layui-icon">&#xe654;</i>发布
          </button>
     </div>
  	<table class="layui-table" id="supplierTable" lay-filter="table">
  		<caption>我的商品</caption>
  	</table>
  	<script type="text/html" id="barTpl">
    <a class="layui-btn layui-btn layui-btn-xs" lay-event="edit" shiro:hasPermission="role_edit">编辑</a>
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del" shiro:hasPermission="role_del">删除</a>
	</script>
	<script type="text/html" id="statusTpl">
  	<input type="checkbox" value="{{d.pid}}" lay-filter="isDisableServiceCB" lay-skin="switch" lay-text="上架 |下架 " {{ d.status == 0 ? '' : 'checked' }}>
	</script>


<script type="text/html" id="detailModel">
	<table class="layui-table" id="supplierTable3" lay-filter="table">
  		<caption>订单详情</caption>
  	</table>
</script>
	<table class="layui-table" id="supplierTable2" lay-filter="table">
  		<caption>我的订单</caption>
  	</table>
  	<!-- 表格操作列 -->
	<script type="text/html" id="barTpl2">
	{{# if(d.state === 1){ }}
	<a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="send" shiro:hasPermission="role_send">发货</a>
	{{# } }}
	<a class="layui-btn layui-btn-default layui-btn-xs" lay-event="detail" shiro:hasPermission="role_send">详情</a>
	</script>
  </div>
  
</div>  

<script type="text/javascript">
  layui.config({
    base: '/ssm/consumer/res/static/js/util/' //你存放新模块的目录，注意，不是layui的模块目录
  }).use(['mm','jquery','element'],function(){
    var mm = layui.mm,$ = layui.$,element = layui.element;

});
</script>

<script type="text/javascript" src="/ssm/consumer/js/jquery-1.4.3.min.js"></script>
<script type="text/javascript"
        src="/ssm/static/system/layui/layui.js"></script>
<script type="text/javascript"
        src="/ssm/static/system/js/product/product2.js"></script>
<script type="text/javascript"
        src="/ssm/static/system/js/order/order2.js"></script>
<script type="text/javascript">

$("#searchbutton").click(function Search(){
	location.href="/ssm/consumer/index.html?pname="+$("#keyword").val();
	return false;
})

$("#keyword").val(getQueryString('pname'));


var info;
getUserInfo();
function  getUserInfo(){
    $.ajax({
        url:"/ssm/consumer/loginInfo.do",
        type:"POST",
        dataType:"json",
        success:function(data){
        	info = data.body
           if(info!=null){
        	   $(".userLogin").hide();
        	   $("#username").text(info.real_name);
        	   $(".userNotLogin").show();
           }else{
        	   location.href="/ssm/consumer/login.html";
           }
        } 
    })
 }
 
function getQueryString(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
    var r = window.location.search.substr(1).match(reg);
    if (r != null) return decodeURI(r[2]); return null;
} 

function loginOut(){
	$.post('/ssm/consumer/logout.do',function(){
		
		location.href="/ssm/consumer/login.html";
	})
}

function updateState(oid,state){
	var postData = {
			oid:oid,
			state:state,
			
	}
	$.post('/ssm/order/updateStatus.do',postData,function(data){
		location.reload();
	})
	
}
</script>
</body>
</html>